package com.sky.mapper;


import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 目标：
 *
 * @author Ashely
 * @date 2024/6/8 20:08
 */
@Mapper
public interface DishMapper {
    @Select("select count(category_id) from dish where category_id=#{id} group by category_id")
    Integer countByCategoryId(Long id);
    @AutoFill(value = OperationType.INSERT)
    void addDish(Dish dish);

    Page<DishVO> page(DishPageQueryDTO dishPageQueryDTO);
@Delete("delete from dish where id in (#{id})")
    void delete(Long id);
@Select("select * from dish where id=#{id}")
    Dish getById(Long id);
@AutoFill(value = OperationType.UPDATE)
    void update(Dish dish);
    List<Dish> list(Dish dish);
    @Select("select count(*) from dish where status = #{status}")
    Integer countStatus(Integer status);
}